<template>
	<view>
		<cu-custom :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">系统设置</block>
		</cu-custom>
		<view class="flex justify-center align-center padding-xl" style="width: 100%;">
			<button @tap="logoutAction" class="cu-btn bg-gradual-blue" style="width: 70%;">注销登录</button>
		</view>
	</view>
</template>

<script>
	import {
		logout,
		commonLogin
	} from '@/api/auth.js'
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			logoutAction() 
			{
				let result = logout() 
				if(result == true) {
					//主动刷新一下后台会话的Session，准备下一次登录
					commonLogin()
					uni.showToast({
						icon:'none',
						title:'注销成功'
					})
					uni.reLaunch({
						url:'/pages/index/index'
					})
				}else{
					uni.showToast({
						icon:'none',
						title:'注销失败'
					})
				}
			}
		}
	}
</script>

<style>

</style>
